/**
 * 
 */
package com.pkdl.forms;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;

/**
 * @author Administrator
 * 
 */
public class DlgCapNhatThemDichVu extends JDialog {
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			DlgCapNhatThemDichVu dialog = new DlgCapNhatThemDichVu(null, true);
			dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private JTextField txtMaDichVu;
	private JTextField txtTenDichVu;
	public String MaDichVu;
	public String TenDichVu;
	public String KetLuan = "";
	private JTextArea txtKetLuan;
	public String DichVuStr;

	/**
	 * Create the dialog.
	 */
	public DlgCapNhatThemDichVu(Frame parent, boolean modal) {
		super(parent, modal);
		this.setTitle("Them dich vu");
		this.setBounds(100, 100, 450, 300);
		this.getContentPane().setLayout(new BorderLayout());
		{
			JPanel panel = new JPanel();
			panel.setBackground(SystemColor.textHighlight);
			this.getContentPane().add(panel, BorderLayout.NORTH);
			panel.setLayout(new BorderLayout(0, 0));
			{
				JLabel lblThmDchV = new JLabel(
						"C\u1EACP NH\u1EACT D\u1ECACH V\u1EE4");
				lblThmDchV.setPreferredSize(new Dimension(31, 32));
				lblThmDchV.setHorizontalAlignment(SwingConstants.CENTER);
				lblThmDchV.setForeground(Color.WHITE);
				lblThmDchV.setFont(new Font("Tahoma", Font.BOLD, 18));
				panel.add(lblThmDchV, BorderLayout.NORTH);
			}
		}
		{
			JPanel panel = new JPanel();
			panel.setLayout(null);
			this.getContentPane().add(panel, BorderLayout.CENTER);
			{
				JLabel lblMDchV = new JLabel("M\u00E3 d\u1ECBch v\u1EE5");
				lblMDchV.setBounds(24, 25, 74, 14);
				panel.add(lblMDchV);
			}
			{
				JLabel lblTenDchV = new JLabel("T\u00EAn d\u1ECBch v\u1EE5");
				lblTenDchV.setBounds(24, 53, 74, 14);
				panel.add(lblTenDchV);
			}
			{
				JButton btnThem = new JButton("Th\u00EAm");
				btnThem.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						if (DlgCapNhatThemDichVu.this.txtKetLuan.getText()
								.equals("")) {
							JOptionPane.showMessageDialog(null,
									"Vui long nhap ket luan", "Announcement",
									JOptionPane.INFORMATION_MESSAGE);
						} else {
							DlgCapNhatThemDichVu.this.KetLuan = DlgCapNhatThemDichVu.this.txtKetLuan
									.getText();
							DlgCapNhatThemDichVu.this.dispose();
						}
					}
				});
				btnThem.setIcon(new ImageIcon(DlgCapNhatThemDichVu.class
						.getResource("/com/pkdl/resources/001_01.gif")));
				btnThem.setBounds(293, 200, 127, 23);
				panel.add(btnThem);
			}

			this.txtMaDichVu = new JTextField();
			this.txtMaDichVu.setEditable(false);
			this.txtMaDichVu.setColumns(10);
			this.txtMaDichVu.setBounds(107, 22, 121, 20);
			panel.add(this.txtMaDichVu);

			this.txtTenDichVu = new JTextField();
			this.txtTenDichVu.setColumns(10);
			this.txtTenDichVu.setBounds(107, 50, 313, 20);
			panel.add(this.txtTenDichVu);
			{
				JLabel lblKtLun = new JLabel("K\u1EBFt lu\u1EADn");
				lblKtLun.setBounds(24, 109, 74, 14);
				panel.add(lblKtLun);
			}

			this.txtKetLuan = new JTextArea();
			this.txtKetLuan.setBounds(107, 81, 313, 108);
			panel.add(this.txtKetLuan);
		}
		this.setLocationRelativeTo(null);
	}

	public void loadThongTin() {
		this.MaDichVu = this.DichVuStr.split("-")[0].trim();
		this.TenDichVu = this.DichVuStr.split("-")[1].trim();
		this.txtMaDichVu.setText(this.MaDichVu);
		this.txtTenDichVu.setText(this.TenDichVu);
		this.txtKetLuan.setText(this.KetLuan);
	}

	public void loadThongTin2() {
		this.txtMaDichVu.setText(this.MaDichVu);
		this.txtTenDichVu.setText(this.TenDichVu);
		this.txtKetLuan.setText(this.KetLuan);
	}
}
